#ifndef _SOFT_INTERFACE_H_
#define _SOFT_INTERFACE_H_

/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>

#include "siConf.h"
/* Public typedef -----------------------------------------------------------*/
struct SoftI2c
{
    struct Gpio sda;
    struct Gpio scl;
};

struct SoftSpi
{
    struct Gpio mosi;
    struct Gpio miso;
    struct Gpio sck;
    struct Gpio nss;
};
/* Public define ------------------------------------------------------------*/
/* Public macro -------------------------------------------------------------*/
#define SOFT_SPI_IO_ASSIGN(spi, foot, pinName)    {(spi).foot.port=GPIO_PORT_##pinName; (spi).foot.pin=GPIO_PIN_##pinName; } 
/* Public variables ---------------------------------------------------------*/
/* Public function prototypes -----------------------------------------------*/
/* Public functions ---------------------------------------------------------*/
int SoftI2c_ExecuteCommand(struct SoftI2c *i2c, uint8_t deviceAddr, uint8_t command);
int SoftI2c_SingleWrite(struct SoftI2c *i2c, uint8_t deviceAddr, uint8_t registerAddr, uint8_t data);
int SoftI2c_MultiWrite(struct SoftI2c *i2c, uint8_t deviceAddr, uint8_t registerAddr, uint8_t *data, size_t len);
int SoftI2c_Read(struct SoftI2c *i2c, uint8_t deviceAddr, uint8_t registerAddr, uint8_t *data, size_t len);

void SoftSpi_NssControl(struct SoftSpi *sspi, bool isEnable);
uint8_t SoftSpi_WriteRead(struct SoftSpi *sspi, uint8_t data);
int SoftSpi_Write(struct SoftSpi *sspi, uint8_t *data, size_t length);
int SoftSpi_Read(struct SoftSpi *sspi, uint8_t *data, size_t length);
#endif
